//
//  ProductCell.m
//  YunGou
//
//  Created by macbook on 16/6/3.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "ProductCell.h"
#import <UIImageView+WebCache.h>
#import "YGProgressBarView.h"
@interface ProductCell ()

@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UILabel *titLabel;
@property (weak, nonatomic) IBOutlet UILabel *totalNeedLabel;
@property (weak, nonatomic) IBOutlet YGProgressBarView *progressView;
@property (weak, nonatomic) IBOutlet UILabel *surplusLabel;
@end

@implementation ProductCell
- (void)setProductModel:(ProductModel *)productModel{
    [_imageView sd_setImageWithURL:[NSURL URLWithString:[ImageUrl stringByAppendingString:productModel.thumb]]];
    _titLabel.text = productModel.title;
    _totalNeedLabel.text = [NSString stringWithFormat:@"总需 %ld",productModel.zongrenshu];
    _surplusLabel.text = [NSString stringWithFormat:@"%ld",productModel.zongrenshu - productModel.canyurenshu];
    _progressView.progress = (double)productModel.canyurenshu/productModel.zongrenshu;
}

- (IBAction)addShopCartClicked:(id)sender {
    if (self.block) {
        self.block();
    }
}


@end
